using System.Collections;
using UnityEngine;

public class InGameTutorialMissionBeaconEnabled : InGameTutorialObject
{
	[SerializeField]
	private float updateTime;

	[SerializeField]
	private MissionBeacon[] beacons;

	public override bool OnStepStart(string name)
	{
		if (base.OnStepStart(name))
		{
			StartCoroutine(UpdateState());
			return true;
		}
		return false;
	}

	public IEnumerator UpdateState()
	{
		bool started = false;
		for (int j = 0; j < values.Length; j++)
		{
			if (values[j].started)
			{
				started = true;
				break;
			}
		}
		while (started && ManagerMissions.currMission == null)
		{
			for (int i = 0; i < beacons.Length; i++)
			{
				if (beacons[i].visible)
				{
					Use();
					break;
				}
			}
			yield return BCWUtils.WaitForRealSeconds(updateTime);
		}
	}
}
